// src/utils/auth.js

// 获取存储的 token
export function getToken() {
    return localStorage.getItem('token');
  }
  
  export function getRole() {
    const role = localStorage.getItem('role');
    return { role };
  }
  // 设置 token
  export function setToken(token,role) {
    localStorage.setItem('token', token);
    localStorage.setItem('role', role);
  }
  
  // 删除 token
  export function removeToken() {
    localStorage.removeItem('token');
    localStorage.removeItem('role');
  }
  
  // 检查用户是否登录
  export function isLoggedIn() {
    return !!getToken();
  }
  